package com.cd.service.message.impl;

import java.util.List;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.cd.bean.Message;
import com.cd.dao.MessageMapper;
import com.cd.service.message.MessageService;

/**
 *网上留言
 *@Author zhk
 *@Date 2017-12-20
 **/
@Service("messageService")
public class MessageServiceImpl implements MessageService{

	@Resource
	MessageMapper messageMapper;
	
	@SuppressWarnings("unchecked")
	@Override
	public void save(Message msg) throws Exception {
		messageMapper.save(msg);
	}

	@Override
	public void delete(Integer id) throws Exception {
		messageMapper.delete(id);
	}

	@Override
	public void edit(Message msg) throws Exception {
		messageMapper.update(msg);
	}

	@Override
	public List<Message> listAll() throws Exception {
		return messageMapper.queryByList();	
	}

	@Override
	public Message findById(Integer id) throws Exception {
		return messageMapper.query(id);
	}

	@Override
	public void deleteAll() throws Exception {
		
	}
	/**
	 * 获取总记录数目
	 */
	@Override
	public Integer size() throws Exception {
		return messageMapper.getCount();
	}
	/**
	 * 查询未回复的留言
	 */
	@Override
	public List<Message> findWithoutReply() throws Exception {
		return messageMapper.queryWithoutReply();
	}
	
	
	
	
}
